"""
@author: ty
@file: zuoye.py
@time: 2022/12/12 20:08
"""
# # filter把合法的用户名显现出来
# username = []

# 匿名函数+reduce实现1*2*3*4
# from functools import reduce
# n = int(input("请输入您想要几的阶乘："))
# result =reduce(lambda x,y:x*y,range(1,n+1))
# print(result)

# filter函数：找出[1-100]能被3整除的数
# def f(x):
#     return x%3==0
# lst1 = filter(f,range(1,101))
# print(list(lst1))

# map函数：求list[1-10]各项的平方
# def f(x):
#     return x*x
# print(list(map(f,range(1,11))))

# 将列表[1,4,5,9] 转换成 '1459’的字符串
from functools import reduce
lst2 = [1,4,5,9]
print(reduce(lambda x,y:str(x)+str(y),lst2))

# 这是一个字符串排序，s = 'asdf234GDSdsf23' 排序规则：小写<大写<奇数<偶数
s = 'asdf234GDSdsf23'
print("".join(sorted(s, key=lambda x: (x.isdigit(), x.isdigit() and int(x)%2==0, x.isupper(), x))))
